/* 
 * File:   drv_adc.h
 * Author: Omar Sevilla
 *
 * Created on 7 de diciembre de 2013, 10:04 PM
 */

#ifndef DRV_ADC_H
#define	DRV_ADC_H

#ifdef	__cplusplus
extern "C" {
#endif
    
#include "system.h"
#include "stdtypedef.h"
    
/*ADC Configuration Instructions*/
#define ADC_ON          (1)
#define ADC_VSS_REF     (~(1 << 5))
#define ADC_VDD_REF     (~(1 << 4))
#define CLEAR_ADC_PORTS (~(0x0F))

#define RIGHT_JUST      (1 << 7)

#define CLEAR_TAD       (0)
#define TAD_0           (0 << 3)

#define CLEAR_CONV_TIME (0)
#define FOSC_64         (2)
#define FRC             (7)

#define CH0     0
#define CH1     1
#define CH2     2
#define CH4     4

    extern void init_adc(void);
    extern T_UWORD get_adc(T_UBYTE lub_adc_channel);

#ifdef	__cplusplus
}
#endif

#endif	/* DRV_ADC_H */

